package com.qingke.Qiximybatis;

import java.io.InputStream;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import com.qingke.Qiximybatis.business.Exit14;
import com.qingke.Qiximybatis.business.Increase4;
import com.qingke.Qiximybatis.business.InforInvited13;
import com.qingke.Qiximybatis.business.Interest5;
import com.qingke.Qiximybatis.business.InvitationIn12;
import com.qingke.Qiximybatis.business.Login;
import com.qingke.Qiximybatis.business.ManyPersonal10;
import com.qingke.Qiximybatis.business.Personal9;
import com.qingke.Qiximybatis.business.Register;
import com.qingke.Qiximybatis.business.SchoolSystem6;
import com.qingke.Qiximybatis.business.SelectBeauty8;
import com.qingke.Qiximybatis.business.SelectMan11;
import com.qingke.Qiximybatis.business.Update3;
import com.qingke.Qiximybatis.business.UpdateStudent7;
import com.qingke.Qiximybatis.mapper.MyUserMapper;
import com.qingke.Qiximybatis.sqlclass.MyUser;

public class QixiDao {
	public QixiDao(){
		
	}
	
	public static SqlSession mybatisSession(){
		String resource = "mybatis_conf.xml";
		InputStream is=null;
		is=QixiApp.class.getClassLoader().getResourceAsStream(resource);
		SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(is);
		SqlSession session = sessionFactory.openSession();
		return session;
	}
	
	public static void users() {
		SqlSession session = mybatisSession();
		MyUserMapper myUserMapper = session.getMapper(MyUserMapper.class);
		List<MyUser> myUsers = myUserMapper.getAllUsers(session);
		for (MyUser u : myUsers) {
			System.out.println(u);
		}
	}
	
}
